package cn.ifavor.appframework.lifecycle;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;

import cn.ifavor.appframework.R;
import cn.ifavor.appframework.lifecycle.app.DefaultApplication;
import cn.ifavor.appframework.lifecycle.bean.User;

public class LoginActivity extends AppCompatActivity {

    private EditText mEtName;
    private EditText mEtAge;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        mEtName = (EditText) findViewById(R.id.et_name);
        mEtAge = (EditText) findViewById(R.id.et_age);

    }

    public void login(View view){
        DefaultApplication.sUser = new User();
        DefaultApplication.sUser.setName(mEtName.getText().toString().trim());
        DefaultApplication.sUser.setAge(Integer.parseInt(mEtName.getText().toString().trim()));

        startActivity(new Intent(this, HomeActivity.class));
    }

}

